import junit.framework.TestCase;
import org.junit.Test;

public class shiyan2_4Test extends TestCase {
    shiyan2_4 a = new shiyan2_4(4,5);
    shiyan2_4 b = new shiyan2_4(3,7);
    shiyan2_4 c = new shiyan2_4(2.7,9.5);
    shiyan2_4 d = new shiyan2_4(8,2.1);
    shiyan2_4 e = new shiyan2_4(8,1);
    @Test
    public void testgetRealPart() throws Exception {
        assertEquals(4.0,a.getRealPart());
        assertEquals(2.7,c.getRealPart());
    }
    @Test
    public void testgetImagePart()throws Exception{
        assertEquals(7.0,b.getImagePart());
        assertEquals(2.1,d.getImagePart());
    }
    @Test
    public void testComplexjiafa()throws Exception{
        assertEquals(7.0,a.Complexjiafa(b).realpart);
        assertEquals(11.6,c.Complexjiafa(d).imagepart);
    }
    @Test
    public void testComplexjianfa()throws Exception{
        assertEquals(1.0,a.Complexjianfa(b).realpart);
        assertEquals(7.4,c.Complexjianfa(d).imagepart);
    }
    @Test
    public void testComplexchengfa()throws Exception{
        assertEquals(-23.0,a.Complexchengfa(b).realpart);
        assertEquals(81.67,c.Complexchengfa(d).imagepart);
    }
    @Test
    public void testComplexchufa()throws Exception{
        assertEquals(4.111111111111111,e.Complexchufa(a).realpart);
        assertEquals(0.2,e.Complexchufa(a).imagepart);
    }
}